import { defHttp } from '@/utils/http/axios';
import { BasicFetchResult } from '../model/baseModel';

enum Api {
  SysDictDataApi = '/sysDictData',
}
/**
 * 查询系统字典值列表
 * @author frank
 * @date 2022-09-01 10:42:20
 */
export const getSysDictDataList = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({
    url: Api.SysDictDataApi + '/list',
    params: { ...params, field: 'sort', order: 'ascend' },
  });
/**
 * 添加系统字典值表
 * @author frank
 * @date 2022-09-01 10:42:22
 */
export const addSysDictData = (params?: any) =>
  defHttp.post({ url: Api.SysDictDataApi + '/add', params });
/**
 * 修改系统字典值表
 * @author frank
 * @date 2022-09-01 10:42:22
 */
export const editSysDictData = (params?: any) =>
  defHttp.post({ url: Api.SysDictDataApi + '/edit', params });
/**
 * 删除系统字典值表
 * @author frank
 * @date 2022-09-01 10:42:22
 */
export const deleteSysDictData = (params: string[]) =>
  defHttp.post({ url: Api.SysDictDataApi + '/delete', params });
/**
 * 导出系统字典值表
 * @author frank
 * @date 2022-09-01 10:42:22
 */
export const exportSysDictData = (id: string) =>
  defHttp.get(
    { responseType: 'blob', url: Api.SysDictDataApi + '/export', params: { id } },
    { isReturnNativeResponse: true },
  );
